﻿using Company.Core.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace Company.Hardware.Camera
{
    /// <summary>
    /// 图像结构体
    /// </summary>
    public struct CameraImage
    {
        /// <summary>
        /// 图像指针
        /// </summary>
        public IntPtr IntPtr { get; }

        /// <summary>
        /// 图像宽度
        /// </summary>
        public int Width { get; }

        /// <summary>
        /// 图像高度
        /// </summary>
        public int Height { get; }

        /// <summary>
        /// 图像大小
        /// </summary>
        public long Size => Width * Height * Marshal.SizeOf(typeof(ColorBGRA));

        public CameraImage(UnmanagedArray2D<ColorBGRA> array)
        {
            IntPtr = array.IntPtr;
            Width = array.Width;
            Height = array.Height;
        }
    }
}
